﻿#ifndef FILELISTTHREAD_H
#define FILELISTTHREAD_H

#include <QThread>
#include "string"
using namespace std;

struct YFileListInfo{
    bool marked;//已标注
    char fileName[256];
    char filePath[512];
    YFileListInfo(){

    }
    void setFileName(string str){
        memset(fileName,0,256);
        memcpy(fileName,str.c_str(),str.length() < 256 ? str.length() : 256);
    }
    void setFilePath(string str){
        memset(filePath,0,512);
        memcpy(filePath,str.c_str(),str.length() < 512 ? str.length() : 512);
    }
};

class FileListThread : public QThread
{
    Q_OBJECT
public:
    explicit FileListThread(QObject *parent = nullptr);
    ~FileListThread();
    void stop();
    void setDirPath(const QString &value);
    void setFilter(const QString &value);

signals:
    void signal_clearList();
    void signal_fileList(QList<YFileListInfo> infos);
private:
    bool isRun;
    QString dirPath;
    QString filter;
protected:
    void run() override;
};

#endif // FILELISTTHREAD_H
